package com.ssi.mrms.action.room;

import static com.opensymphony.xwork2.Action.SUCCESS;

import java.util.List;

import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Namespaces;
import org.apache.struts2.convention.annotation.Result;

import com.ssi.mrms.action.BaseAction;
import static com.ssi.mrms.action.BaseAction.lookupBean;
import com.ssi.mrms.model.TowerModel;
import com.ssi.mrms.service.CarStickerService;
import com.ssi.mrms.service.ComboboxService;
import com.ssi.mrms.view.SelectBoxView;

@Namespaces(value = {
    @Namespace("/room")
})
public class RM002Action extends BaseAction {

    private static final Logger logger = Logger.getLogger(RM002Action.class);

    private ComboboxService comboboxService = lookupBean(ComboboxService.class, "ComboboxService");
    private CarStickerService carStickerService = lookupBean(CarStickerService.class, "CarStickerService");

    private List<SelectBoxView> comboTower = null;
    private List<SelectBoxView> comboFloor = null;
    private List<SelectBoxView> comboUnit = null;
    private List<SelectBoxView> comboAddress = null;
    private TowerModel towerModel = null;

    public RM002Action() {
        logger.info("## ");
        comboTower = comboboxService.getTower();
        comboFloor = comboboxService.getFloor(null);
        comboUnit = comboboxService.getUnit(null);
        comboAddress = comboboxService.getAddress(null);
    }

    @Action(value = "/RM002", results = {
        @Result(name = "success", location = "RM002.tiles", type = "tiles")
    })
    public String execute() throws Exception {
        logger.info("## " + this.getClass().getSimpleName());

        comboTower = comboboxService.getTower();
        comboFloor = comboboxService.getFloor(towerModel);
        comboUnit = comboboxService.getUnit(towerModel);
        comboAddress = comboboxService.getAddress(towerModel);

        return SUCCESS;
    }

    //    ------------ get & set -----------	
    public List<SelectBoxView> getComboTower() {
        return comboTower;
    }

    public void setComboTower(List<SelectBoxView> comboTower) {
        this.comboTower = comboTower;
    }

    public List<SelectBoxView> getComboFloor() {
        return comboFloor;
    }

    public void setComboFloor(List<SelectBoxView> comboFloor) {
        this.comboFloor = comboFloor;
    }

    public List<SelectBoxView> getComboUnit() {
        return comboUnit;
    }

    public void setComboUnit(List<SelectBoxView> comboUnit) {
        this.comboUnit = comboUnit;
    }

    public List<SelectBoxView> getComboAddress() {
        return comboAddress;
    }

    public void setComboAddress(List<SelectBoxView> comboAddress) {
        this.comboAddress = comboAddress;
    }

    public TowerModel getTowerModel() {
        return towerModel;
    }

    public void setTowerModel(TowerModel towerModel) {
        this.towerModel = towerModel;
    }

}
